/**
 */
package Alloy.impl;

import Alloy.AlloyPackage;
import Alloy.QualityRuleset;
import Alloy.Universal;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Quality Ruleset</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link Alloy.impl.QualityRulesetImpl#getBearer <em>Bearer</em>}</li>
 *   <li>{@link Alloy.impl.QualityRulesetImpl#getQuality <em>Quality</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class QualityRulesetImpl extends RulesetImpl implements QualityRuleset {
	/**
	 * The cached value of the '{@link #getBearer() <em>Bearer</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBearer()
	 * @generated
	 * @ordered
	 */
	protected Universal bearer;

	/**
	 * The cached value of the '{@link #getQuality() <em>Quality</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getQuality()
	 * @generated
	 * @ordered
	 */
	protected Universal quality;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected QualityRulesetImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return AlloyPackage.Literals.QUALITY_RULESET;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Universal getBearer() {
		if (bearer != null && bearer.eIsProxy()) {
			InternalEObject oldBearer = (InternalEObject)bearer;
			bearer = (Universal)eResolveProxy(oldBearer);
			if (bearer != oldBearer) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, AlloyPackage.QUALITY_RULESET__BEARER, oldBearer, bearer));
			}
		}
		return bearer;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Universal basicGetBearer() {
		return bearer;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setBearer(Universal newBearer) {
		Universal oldBearer = bearer;
		bearer = newBearer;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, AlloyPackage.QUALITY_RULESET__BEARER, oldBearer, bearer));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Universal getQuality() {
		if (quality != null && quality.eIsProxy()) {
			InternalEObject oldQuality = (InternalEObject)quality;
			quality = (Universal)eResolveProxy(oldQuality);
			if (quality != oldQuality) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, AlloyPackage.QUALITY_RULESET__QUALITY, oldQuality, quality));
			}
		}
		return quality;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Universal basicGetQuality() {
		return quality;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setQuality(Universal newQuality) {
		Universal oldQuality = quality;
		quality = newQuality;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, AlloyPackage.QUALITY_RULESET__QUALITY, oldQuality, quality));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case AlloyPackage.QUALITY_RULESET__BEARER:
				if (resolve) return getBearer();
				return basicGetBearer();
			case AlloyPackage.QUALITY_RULESET__QUALITY:
				if (resolve) return getQuality();
				return basicGetQuality();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case AlloyPackage.QUALITY_RULESET__BEARER:
				setBearer((Universal)newValue);
				return;
			case AlloyPackage.QUALITY_RULESET__QUALITY:
				setQuality((Universal)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case AlloyPackage.QUALITY_RULESET__BEARER:
				setBearer((Universal)null);
				return;
			case AlloyPackage.QUALITY_RULESET__QUALITY:
				setQuality((Universal)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case AlloyPackage.QUALITY_RULESET__BEARER:
				return bearer != null;
			case AlloyPackage.QUALITY_RULESET__QUALITY:
				return quality != null;
		}
		return super.eIsSet(featureID);
	}

} //QualityRulesetImpl
